package net.huashitong.ssydt.security.utils;

import net.huashitong.ssydt.provider.utils.StringUtils;

/**
 * @author hemj
 * @version 2017/8/8
 */
public class MobileUtils {

    /**
     * 获取加密的电话号码
     *
     * @param mobile
     * @return xxx****yyyy
     */
    public static String getEncodeMobile(String mobile) {
        if (StringUtils.isNotBlank(mobile)) {
            StringBuilder sb = new StringBuilder(mobile);
            int len = sb.length() < 7 ? sb.length() : 7;
            for (int i = 3; i < len; ++i) {
                sb.setCharAt(i, '*');
            }
            return sb.toString();
        }
        return null;

    }

}
